package com.xzd.dao.Impl;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.xzd.dao.PersonDao;
import com.xzd.model.Person;
import com.xzd.util.JsonUtil;

public class PersonDaoImpl extends HibernateDaoSupport  implements PersonDao {

	public Person getObjectById(Integer id) {
		return  (Person)this.getHibernateTemplate().get(Person.class, id); 
	}

	public void save(Person obj) {
		 System.out.println( JsonUtil.toJson(obj));
		 this.getHibernateTemplate().save(obj);
	}

	public List selectAll(String hql) {
		return this.getHibernateTemplate().find(hql); 
	}

	public void update(Person obj) {
		this.getHibernateTemplate().update(obj); 
	}

	public void delete(Person obj) {
		this.getHibernateTemplate().delete(obj);
	}
	
}
